<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include_once '../Login/databaseconnection.php';

if(!loggedin())
{
	require_once '../index.php';
}
else
{
$Cen_No=$_SESSION['Census_Number'];

   $School_Id=$_POST['School_Id'];
   $Zone=$_POST['Zone'];
 $Division=$_POST['Division'];
   $Province=$_POST['Province'];
  $District=$_POST['District'];
 $Census_Number=$_POST['Census_Number'];

  $Name=$_POST['Name'];
 $Status=$_POST['Status'];
 $Type=$_POST['Type'];
  $Grade_Range=$_POST['Grade_Range'];
   $Medium=$_POST['Medium'];
 $Female_Students=$_POST['Female_Students'];
  $Male_Students=$_POST['Male_Students'];
 $Tp_Number=$_POST['Tp_Number'];
  $Fax_Number=$_POST['Fax_Number'];
  $E_Mail=$_POST['E_Mail'];
  $Web_Address=$_POST['Web_Address'];
  $Special_Projects=$_POST['Special_Projects'];
  $Special_Projects_other=$_POST['Special_Projects_other'];
$S_Pro="";
  for($i=0;$i<count($Special_Projects);$i++)
  {
  if($Special_Projects[$i]=="Others")
  {
	 $S_Pro+=$Special_Projects_other;
  }
  else
  {
  $S_Pro+=$Special_Projects[$i];
  }
  }
  $Address=$_POST['Address'];
 $Account_Number=$_POST['Account_Number'];
  if($Census_Number==""||$School_Id==""||$Zone==""||$Division==""||$Province==""||$District==""||$Name==""||$Status==""||$Type==""||$Grade_Range==""||$Medium==""||$Female_Students==""||$Male_Students==""||$Tp_Number==""||$Fax_Number==""||$E_Mail==""||$Web_Address==""||$Special_Projects==""||$Address==""||$Account_Number=="")
  {
	  $_SESSION['errorin']="Please check your inputs!";
  }
 if($Census_Number!=""&&$School_Id!=""&&$Zone!=""&&$Division!=""&&$Province!=""&&$District!=""&&$Name!=""&&$Status!=""&&$Type!=""&&$Grade_Range!=""&&$Medium!=""&&$Female_Students!=""&&$Male_Students!=""&&$Tp_Number!=""&&$Fax_Number!=""&&$E_Mail!=""&&$Web_Address!=""&&$Special_Projects!=""&&$Address!=""&&$Account_Number!="")
  {

  $sql=mysql_query("UPDATE school SET Census_Number='$Cen_No',School_Id='$School_Id',Zone='$Zone',Division='$Division',Province='$Province',District='$District',Name='$Name',Status='$Status',Type='$Type',Grade_Range='$Grade_Range',Medium='$Medium',Female_Students='$Female_Students',Male_Students='$Male_Students',Tp_Number='$Tp_Number',Fax_Number='$Fax_Number',E_Mail='$E_Mail',Web_Address='$Web_Address',Special_Projects='$Special_Projects',Address='$Address',Account_Number='$Account_Number' WHERE Census_Number='$Cen_Number'");
unset($_SESSION['Census_Number']);
if($sql)
  {
$_SESSION['error']="This record is successfully updated!";

  }

  if(!$sql)
  {
 $_SESSION['error']="Sorry unable to update this record!";


  }
  }
}


?>
</body>
</html>
